import { configureStore } from '@reduxjs/toolkit';
import cartReducer from './cart';
import newsReducer from './news';
// 导入redux-logger中间件
// import logger from 'redux-logger';
// import thunk from 'redux-thunk';
const store = configureStore({
    // 注册reducer函数
    reducer: {
        cart: cartReducer,
        news: newsReducer
    },
    // 注册中间件: 虽然@reduxjs/toolkit中内置了redux-thunk, 但是如果注册了redux-logger中间件, 就需要在此处在注册下redux-thunk中间件, 否则会有报错`Uncaught Error: Actions must be plain objects. Use custom middleware for async actions.`; 
    // middleware: [logger,thunk]
});

export default store;